<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // const num = 1.23656;
      const num = 1.2;

      // 乘除法
      console.log(Math.round(num * 100) / 100); //1.20

      // toFiexd 可以保留任意小数位
      console.log(num.toFixed(2)); //"1.20"
    </script>
  </body>
</html>
